package demo8;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.sql.Connection;

public class Demo {
    public static void main(String[] args) throws Exception {
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext(Config.class);

        Person p = context.getBean(Person.class);
        System.out.println(p);

        Student s = context.getBean(Student.class);
        System.out.println(s);

        DBUtil db = context.getBean(DBUtil.class);
        Connection connection = db.getConnection();
    }
}
